package com.czh.dubbo.impl;

import com.czh.dubbo.api.DemoService;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.concurrent.ThreadLocalRandom;

@DubboService
public class DemoServiceImpl implements DemoService {

    private void commonSleep(){
        int sleepTime = ThreadLocalRandom.current().nextInt(101);
        try {
            Thread.sleep(sleepTime);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Override
    public String methodA(String param) {
        commonSleep();
        return "y";
    }

    @Override
    public String methodB(String param) {
        commonSleep();
        return "y";
    }

    @Override
    public String methodC(String param) {
        commonSleep();
        return "y";
    }
}
